FROM microsoft/aspnetcore:2.0 AS base
WORKDIR /app
EXPOSE 80

FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY *.sln ./
COPY Scaffold.API/Scaffold.API.csproj Scaffold.API/
COPY Scaffold.BootStrapper/Scaffold.BootStrapper.csproj Scaffold.BootStrapper/
COPY Scaffold.Domain/Scaffold.Domain.csproj Scaffold.Domain/
COPY EStart.Infrastructure/EStart.Infrastructure.csproj EStart.Infrastructure/
COPY Scaffold.AppService/Scaffold.AppService.csproj Scaffold.AppService/
COPY EStart.DataBase.EF/EStart.DataBase.EF.csproj EStart.DataBase.EF/
COPY EStart.Interface/EStart.Interface.csproj EStart.Interface/
COPY EStart.DataBase.Event.Domian/EStart.DataBase.Event.Domian.csproj EStart.DataBase.Event.Domian/
COPY Scaffold.AppService.Model/Scaffold.AppService.Model.csproj Scaffold.AppService.Model/
RUN dotnet restore
COPY . .
WORKDIR /src/Scaffold.API
RUN dotnet build -c Release -o /app

FROM build AS publish
RUN dotnet publish -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Scaffold.API.dll"]
